package com.socool.sinofaith.view;



import com.socool.sinofaith.R;

import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.view.Display;
import android.view.KeyEvent;
import android.view.WindowManager;
import android.view.WindowManager.LayoutParams;


public class LoadingDialog extends Dialog {


	public LoadingDialog(Context context) {
		super(context,R.style.dialog);
	}
	public LoadingDialog(Context context, int theme) {
		super(context, theme);
	}

	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.loading_dialog);
		WindowManager m = getWindow().getWindowManager();
		Display d = m.getDefaultDisplay();
		LayoutParams p = getWindow().getAttributes();
		p.width = 300;
		p.height = 300;
		p.y = 100;
		getWindow().setAttributes(p);
		this.setCanceledOnTouchOutside(false);
		this.setCancelable(false);
	}

	public interface closeState {
		void state(int state);
	}

	@Override
	public boolean onKeyDown(int keyCode, KeyEvent event) {
		if (event.getKeyCode() == KeyEvent.KEYCODE_BACK) {
			return false;
		}
		return super.onKeyDown(keyCode, event);
	}
}
